package com.monitor.display_platform.business.thread.v2.th;

import com.monitor.display_platform.business.thread.v2.Cycle;
import com.monitor.display_platform.business.thread.v2.Observable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TwoConsumer implements Runnable, Observable {

    private static final Logger log = LoggerFactory.getLogger(TwoConsumer.class);
    private int i = 2;
    @Override
    public void run() {
        log.info("start TwoConsumer consumer");
        while(true){
            try {
                if (i == 5){
                    throw new NumberFormatException("数据转换异常");
                }
                Thread.sleep(1000);
                i++;
            } catch (InterruptedException e) {
                
            }
        }
    }

    @Override
    public Cycle getCycle() {

        return null;
    }

    @Override
    public void start() {
        log.info("开始了");
    }

    @Override
    public void interrupt() {

    }
}
